<template>
  <view>
    <u-loading-page
        :loading="loading.open"
    >
    </u-loading-page>

    <!-- 空列表显示 -->
    <view
        v-if="data.son.length === 0"
        style="display: flex;
        justify-content: center;
        align-items: center;
        height:100vh;"
    >
      <u-empty
          textSize="25"
          iconSize="200"
          textTop="0"
          mode="data"
          text="您暂时还没有合伙人噢 ~ "
      >
      </u-empty>
    </view>

    <view>
      <uni-card v-for="(item,index) in data.son" :key=index>
        <template v-slot:title>
          <view style="margin: 20rpx 0;">
            <view>
              <view
                  style="
                  float: right;
                  margin-bottom: 20rpx;"
              >
                <u--image
                    radius="80"
                    :showLoading="true"
                    :src="item.avatar"
                    width="100px"
                    height="100px"
                    @click="service.previewImg([item.avatar])"
                >
                </u--image>
              </view>
              <view>
                <view class="item">
                  <text class="labelFont">微信昵称 :</text>
                  <text class="contentFont">{{item.nick}}</text>
                </view>
                <view class="item">
                  <text class="labelFont">真实姓名 :</text>
                  <text class="contentFont">{{item.name}}</text>
                </view>
                <view class="item">
                  <text class="labelFont">手机号 :</text>
                  <text class="contentFont">{{item.account}}</text>
                </view>
                <view>
                  <text class="labelFont">收益占比 :</text>
                  <text class="contentFont">{{item.shares * 100 + '%'}}</text>
                </view>
              </view>

            </view>
          </view>
        </template>
      </uni-card>
    </view>

  </view>
</template>

<script>
import service from "@/utils/service";

export default {
  data() {
    let _vm = this;
    return {
      service: service,
      data: {
        son: []
      },
      /* 加载对象 */
      loading: {
        // 取消加载 true
        open: true,
        // 进度
        plan: 0,
        // 阈值
        threshold: 0,
        def() {
          this.open = true;
          this.plan = 0;
          this.threshold = 1;
        },
        step() {
          if (++this.plan >= this.threshold && this.open) {
            try {
            } catch (e) {
              console.log(" loading.step() err :  ", e)
            } finally {
              _vm.loading.open = false;
            }
          }
        }
      },
    };
  },
  methods: {
    getDetail() {
      let _t = this;
      this.$axios({
        url: 'merchant/merchantInfo/detail',
        method: "post",
        header: {
          "Authorization": this.token,
          "Content-type": this.contentType,
          "type": "merchantsToken"
        },
      }).then(res => {
        console.log(" merchant/merchantInfo/detail : ", res)
        if (res.code === 0) {
          _t.data.son = res.result.son;
        }else{

        }
      }).finally(() => {
        _t.loading.step()
      })
    }
  },
  onLoad(e) {
    // 获取图像地址前缀
    this.imgApi = this.$reqConfig.URLIMAGE
    // 获取请求头类型
    this.contentType = this.$reqConfig.CONTENTTYPE + ";+charset=UTF-8"
    // 获取token
    this.token = uni.getStorageSync("merchantsToken").token
  },
  onShow() {
    this.getDetail();
  }
}
</script>

<style lang="scss">
.labelFont{
  letter-spacing: 2rpx;
  color: #6f7780;
}
.contentFont{
  letter-spacing: 2rpx;
  font-size: 30rpx;
  font-weight: 545;
  margin-left: 10rpx
}
.item{
  margin-bottom: 10rpx;
}
</style>
